{% extends "base.html" %}
{% block title %}主页{% endblock %}
{% block content %}
<style>
    .active {
    font-weight: bold;
    color: red;
}
</style>
<h2>欢迎{{current_user.username}}来到图书管理系统</h2>
<ul class="list-group list-group-horizontal" style="margin-left:20px">
    <li>&nbsp;&nbsp;<a href="{{ url_for('borrow_manage.borrow_list') }}?all=1" class="{{ 'active' if request.args.get('all') == '1' else '' }}"">全部</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;<a href="{{ url_for('borrow_manage.borrow_list') }}?is_return=1" class="{{ 'active' if request.args.get('is_return') == '1' else '' }}"">已还书</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;<a href="{{ url_for('borrow_manage.borrow_list') }}?is_return=0" class="{{ 'active' if request.args.get('is_return') == '0' else '' }}">未还书</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;<a href="{{ url_for('borrow_manage.borrow_list') }}?is_overdue=1" class="{{ 'active' if request.args.get('is_overdue') == '1' else '' }}">已超期</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;<a href="{{ url_for('borrow_manage.borrow_list') }}?is_pay_overdue=0" class="{{ 'active' if request.args.get('is_pay_overdue') == '0' else '' }}">未支付</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;<a href="{{ url_for('borrow_manage.borrow_list') }}?is_pay_overdue=1" class="{{ 'active' if request.args.get('is_pay_overdue') == '1' else '' }}">已支付</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
</ul>
<table style="width:100%;border:1px">
    <tr>
        <td>编号</td>
        <td>书名</td>
        <td>借阅者</td>
        <td>借阅时间</td>
        <td>还书时间</td>
        <td>是否超期</td>
        <td>超期天数</td>
        <td>超期费用</td>
        <td>是否支付超期费用</td>
        <td>是否归还</td>
        <td>操作</td>
    </tr>
    {% for borrow_book in borrow_books %}
    <tr>
        <td>{{ borrow_book.id }}</td>
        <td>{{ borrow_book.book_name }}</td>
        <td>{{ borrow_book.username }}</td>
        <td>{{ borrow_book.borrow_time }}(已借{{ borrow_book.borrow_time | borrow_days_filter }})</td>
        <td>{{ borrow_book.return_time }}(
            {% if borrow_book.is_overdue %}
            已超期{{ borrow_book.overdue_days }}天
            {% else %}
            剩余{{ borrow_book.return_time | return_days_filter }}
            {% endif %}
            )</td>
        <td>{{ borrow_book.is_overdue | yes_no_filter }}</td>
        <td>{{ borrow_book.overdue_days }}</td>
        <td>{{ borrow_book.overdue_fee }}</td>
        <td>
            {% if borrow_book.is_overdue == 0 %}
            -
            {% else %}
            {{ borrow_book.is_pay_overdue | yes_no_filter }}
            {% endif %}
        </td>
        <td>{{ borrow_book.is_return | yes_no_filter }}</td>
    </tr>
    {% endfor %}
</table>
<p>当前一共有{{borrow_books|length}}条借阅记录</p>

</br>

{% endblock %}